package com.pureut.quality.controller;


import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.common.core.web.page.TableDataInfo;
import com.pureut.common.log.annotation.Log;
import com.pureut.common.log.enums.BusinessType;
import com.pureut.quality.domain.dto.QualityBadSampleDto;
import com.pureut.quality.domain.dto.QualityInspectionDocumentDto;
import com.pureut.quality.domain.vo.QualityInspectionDocumentVo;
import com.pureut.quality.service.QualityBadSampleService;
import org.springframework.web.bind.annotation.*;
import com.pureut.common.core.web.page.TableDataInfo;

import javax.annotation.Resource;
import java.util.List;


/***
 * 检验结果控制层
 * Author:C
 * Date:2023/02/06 17:34
 * @DESC
 */
@RestController
@RequestMapping("/quality-bad-sample")
public class QualityBadSampleController extends BaseController {

    @Resource
    QualityBadSampleService qualityBadSampleService;

    /**
     * 检验结果列表
     *
     * @param
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo getList(String inspectionSheetNo) {
        startPage();
        //查询检验结果列表
        List<QualityBadSampleDto> list = qualityBadSampleService.getList(inspectionSheetNo);
        return getDataTable(list);
    }

    /**
     * 获取检验数量
     */
    @GetMapping("/getNum")
    public int getNum(String inspectionSheetNo) {
        return qualityBadSampleService.getNum(inspectionSheetNo);
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    @Log(title = "删除", businessType = BusinessType.DELETE)
    public AjaxResult delete(Long id, String inspectionSheetNo) {
        return toAjax(qualityBadSampleService.delete(id,inspectionSheetNo));
    }


}
